<?php
/**
 * 左则导航
 */

class LeftController extends Cms_AdminController {
	/**
	 * 初始化
	 */
	public function init() {
	
	}
	
	public function indexAction() {
		
		$menuid = $this->_request->get ( 'menuid' );
		
		if (empty ( $menuid )) {
			$menuid = 1;
		}
		
		$datas = Model_Menu::admin_menu ( $menuid );
		
		$left_menu = "";
		
		foreach ( $datas as $_value ) {
			
			$left_menu .= '<h3 class="f14"><span class="switchs cu on" title="展开与收缩"></span>' . $_value ['name'] . '</h3>';
			
			$left_menu .= '<ul>';
			$sub_array = Model_Menu::admin_menu ( $_value ['id'] );
			foreach ( $sub_array as $_key => $_m ) {
				// 附加参数
				$data = $_m ['data'] ? '&' . $_m ['data'] : '';
				if ($menuid == 5) { // 左侧菜单不显示选中状态
					$classname = 'class="sub_menu"';
				} else {
					$classname = 'class="sub_menu"';
				}
				$left_menu .= '<li id="_MP' . $_m ['id'] . '" ' . $classname . '><a href="javascript:_MP(' . $_m ['id'] . ',\'' . $_m ['controller'] . '\');" hidefocus="true" style="outline:none;">' . $_m ['name'] . '</a></li>';
			}
			$left_menu .= '</ul>';
		}
		
		$this->view->assign ( 'left_menu', $left_menu );
		$this->render ( 'left', null, true );
	}
}
?>